﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MyAdmin/QuanLy.master" AutoEventWireup="true"
    CodeFile="QL_User_AM.aspx.cs" Inherits="MyAdmin_QL_User_AM" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<fieldset>
<legend align="center"><b>Người Dùng</b></legend>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
	<tr>
		<td align="center">
          <asp:GridView ID="gvUsers" runat="server" AutoGenerateColumns="False" AllowPaging="True"
        OnRowEditing="usersGRIDVIEW_RowEditing" OnRowCancelingEdit="usersGRIDVIEW_RowCancelingEdit"
        OnRowUpdating="gvUsers_RowUpdating" EditRowStyle-HorizontalAlign="Center" 
        Width="685px" BackColor="White" BorderColor="#999999" BorderStyle="None" 
        BorderWidth="1px" CellPadding="3" GridLines="Vertical">
        <AlternatingRowStyle BackColor="#DCDCDC" />
        <Columns>
            <asp:CommandField ShowEditButton="True" CancelText="Hủy" EditText="Cập Nhật" 
                UpdateText="Cập Nhật" />
            <asp:TemplateField HeaderText="User">
                <ItemTemplate>
                    <asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserName")%>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserName")%>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:CheckBoxField HeaderText="Ban Nick" DataField="Banned" />
            <asp:TemplateField HeaderText="Email">
                <ItemTemplate>
                    <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email")%>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email")%>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Role">
                <ItemTemplate>
                    <asp:Label ID="lblRoleNameForView" runat="server" Text='<%# Eval("RoleName")%>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="lblRoleNameForEdit" runat="server" Visible="false" Text='<%# Eval("RoleName")%>' />
                    <asp:DropDownList ID="cbbRoleForEdit" DataTextField="RoleName" DataValueField="RoleName"
                        runat="server" AutoPostBack="True" DataSourceID="RoleLinqDataSource" OnDataBound="cbbRoleForEdit_DataBound"
                        OnSelectedIndexChanged="cbbRoleForEdit_SelectedIndexChanged" />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:CheckBox ID="checkXoa" runat="server" AutoPostBack="True" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    <EditRowStyle HorizontalAlign="Center"></EditRowStyle>
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#0000A9" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#000065" />
    </asp:GridView>
        </td>
	</tr>
    <tr>
    <td align="center">
     <asp:Button ID="btnXoaNhieu" runat="server" Text="Xóa Đã Chọn" 
        onclick="btnXoaNhieu_Click" />
    <asp:Button ID="btnThem" runat="server" Text="Thêm Mới" 
        onclick="btnThem_Click" />
    </td>
    </tr>
</table>
  
 
   
    <asp:LinqDataSource ID="RoleLinqDataSource" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
        EntityTypeName="" Select="new (RoleId, RoleName)" TableName="aspnet_Roles" Where="RoleName != @RoleName">
        <WhereParameters>
            <asp:Parameter DefaultValue="admin" Name="RoleName" Type="String" />
        </WhereParameters>
    </asp:LinqDataSource>
   </fieldset>
</asp:Content>
